package com.jingdianjichi.subject.domain.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.*;

@Configuration
public class ThreadPoolConfig {
    @Bean("labelThreadPool")
    public ThreadPoolExecutor threadPoolExecutor() {
        return new ThreadPoolExecutor(20, 100, 5, TimeUnit.SECONDS
                , new LinkedBlockingQueue<>(40)
                , new CustomNameThreadFactory("label")
                , new ThreadPoolExecutor.CallerRunsPolicy());

    }
}
